package com.glsc.ngateway.common.base.domain.mysql.gateway.other;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * @author liwei
 * 交易单元费用表-子表（excel导入内容记录）
 */
@Data
@Entity
@Table(name = "t_am_trade_seat_fees_item")
@org.hibernate.annotations.Table(appliesTo = "t_am_trade_seat_fees_item", comment = "交易单元费用表-子表（excel导入内容记录）")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TradeSeatFeesItem {

   // @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiModelProperty(value = "主键id")
    @Id
    @Column(name = "id", columnDefinition = "varchar(40) COMMENT '主键id'")
    private String id;

    @ApiModelProperty(value = "交易单元号")
    @Column(name = "trade_seat_code", columnDefinition = "varchar(10) COMMENT '交易单元号'")
    private String tradeSeatCode;

    @ApiModelProperty(value = "交易单元名称")
    @Column(name = "trade_seat_name", columnDefinition = "varchar(255) COMMENT '交易单元名称'")
    private String tradeSeatName;

    @ApiModelProperty(value = "市场 字典: am_trade_seat_market")
    @Column(name = "trade_seat_market", columnDefinition = "varchar(10) COMMENT '市场 sh 上海  sz  深圳'")
    private String tradeSeatMarket;

    @ApiModelProperty(value = "年月")
    @DateTimeFormat(pattern = "yyyy-MM")
    @JsonFormat(pattern = "yyyy-MM")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @Column(name = "data_date", columnDefinition = "datetime comment '归属时间'")
    private LocalDateTime dataDate;

    @Builder.Default
    @ApiModelProperty(value = "交易类报盘数量(月)")
    @Column(name = "trading_offer_amount", columnDefinition = "int(11) DEFAULT 0 COMMENT '交易类报盘数量(月)'")
    private Integer tradingOfferAmount = 0;

    @Builder.Default
    @ApiModelProperty(value = "非交易类报盘数量(月)")
    @Column(name = "none_trading_offer_amount", columnDefinition = "int(11) DEFAULT 0 COMMENT '非交易类报盘数量(月)'")
    private Integer noneTradingOfferAmount = 0;

    @Builder.Default
    @ApiModelProperty(value = "交易类报盘数量(年)")
    @Column(name = "trading_offer_year_amount", columnDefinition = "int(11) DEFAULT 0 COMMENT '交易类报盘数量(年)'")
    private Integer tradingOfferYearAmount = 0;

    @Builder.Default
    @ApiModelProperty(value = "非交易类报盘数量(年)")
    @Column(name = "none_trading_offer_year_amount", columnDefinition = "int(11) DEFAULT 0 COMMENT '非交易类报盘数量(年)'")
    private Integer noneTradingOfferYearAmount = 0;

    @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time", columnDefinition = "datetime comment '创建时间'", updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;

}
